package process
import (
	"fmt"
	"go_code/projectExec2/common/message"
	"go_code/projectExec2/client/model"
)

//客户端需要维护的map
var onlineUsers map[int]*message.User = make(map[int]*message.User,10)
var CurUser model.CurUser //在用户登录成功后完成对CurUser初始化

//以下函数处理返回的NotifyUserStatusMes
func updateUserStatus(notifyUserStatusMes *message.NotifyUserStatusMes){
	user ,ok := onlineUsers[notifyUserStatusMes.UserId]
	if !ok{
		user = &message.User{
			UserId : notifyUserStatusMes.UserId,
		}
	}
	user.UserStatus = notifyUserStatusMes.Status
	onlineUsers[notifyUserStatusMes.UserId] = user
}

//客户端显示当前在线的用户
func outputOnlineUser(){
	//遍历onlineUsers
	fmt.Println("前在线用户列表：")
	for i,_ := range onlineUsers{
		fmt.Printf("用户id:%d\n",i)
	}

}